<?php
namespace BP\GPM\AD;
require_once("BP/En/Map.php");
class Emp extends EntityNoName {
	public function getIsEnable () 
	{
		if ($this->getNo()->equals("admin"))
		{
			return  TRUE ;
		}
		$sql = (("SELECT COUNT(FK_Emp) FROM Port_DeptEmpStation WHERE FK_Emp=' " . $this->getNo()) . " '");
		if ((DBAccess->RunSQLReturnValInt($sql, 0) == 0))
		{
			return  FALSE ;
		}
		$sql = (("SELECT COUNT(FK_Emp) FROM Port_DeptEmp WHERE FK_Emp=' " . $this->getNo()) . " '");
		if ((DBAccess->RunSQLReturnValInt($sql, 0) == 0))
		{
			return  FALSE ;
		}
		return  TRUE ;
	}
	public function getPinYin () 
	{
		return $this->GetValStrByKey(EmpAttr::$PinYin);
	}
	public function setPinYin ($value) // [String value]
	{
		$this->SetValByKey(EmpAttr::$PinYin, $value);
	}
	public function getHisDept () 
	{
		try 
		{
			return Dept::constructor__String($this->getFK_Dept());
		}
		catch (\RuntimeException $ex)
		{
			throw new \RuntimeException(((((("@获取操作�? " . $this->getNo()) . " 部门[") . $this->getFK_Dept()) . "]出现错误,可能是系统管理员没有给他维护部门.@") . $ex->getMessage()));
		}
	}
	public function getFK_Dept () 
	{
		return $this->GetValStrByKey(EmpAttr::$FK_Dept);
	}
	public function setFK_Dept ($value) // [String value]
	{
		$this->SetValByKey(EmpAttr::$FK_Dept, $value);
	}
	public function getFK_DeptText () 
	{
		return $this->GetValRefTextByKey(EmpAttr::$FK_Dept);
	}
	public function getTel () 
	{
		return $this->GetValStrByKey(EmpAttr::$Tel);
	}
	public function setTel ($value) // [String value]
	{
		$this->SetValByKey(EmpAttr::$Tel, $value);
	}
	public function getEmail () 
	{
		return $this->GetValStrByKey(EmpAttr::$Email);
	}
	public function setEmail ($value) // [String value]
	{
		$this->SetValByKey(EmpAttr::$Email, $value);
	}
	public function getPass () 
	{
		return $this->GetValStrByKey(EmpAttr::$Pass);
	}
	public function setPass ($value) // [String value]
	{
		$this->SetValByKey(EmpAttr::$Pass, $value);
	}
	public function getIdx () 
	{
		return $this->GetValIntByKey(EmpAttr::$Idx);
	}
	public function setIdx ($value) // [int value]
	{
		$this->SetValByKey(EmpAttr::$Idx, $value);
	}
	public function getSignType () 
	{
		return $this->GetValIntByKey(EmpAttr::$SignType);
	}
	public function setSignType ($value) // [int value]
	{
		$this->SetValByKey(EmpAttr::$SignType, $value);
	}
	public function CheckPass ($pass) // [String pass]
	{
		if ($this->getPass()->equals($pass))
		{
			return  TRUE ;
		}
		return  FALSE ;
	}
	public static function constructor__ () 
	{
		$me = new self();
		return $me;
	}
	public static function constructor__String ($no) // [String no]
	{
		$me = new self();
		$me->setNo($no->trim());
		$me->Retrieve();
		return $me;
	}
	public function getHisUAC () 
	{
		$uac = new UAC();
		$uac->OpenForAppAdmin();
		return $uac;
	}
	public function getEnMap () 
	{
		if (($this->get_enMap() != NULL))
		{
			return $this->get_enMap();
		}
		$map = new Map();
		$map->setEnDBUrl(new DBUrl($DBUrlType->AppCenterDSN));
		$map->setPhysicsTable("Port_Emp");
		$map->Java_SetDepositaryOfMap($Depositary->Application);
		$map->Java_SetDepositaryOfEntity($Depositary->None);
		$map->setEnDesc("用户");
		$map->Java_SetEnType($EnType->App);
		$map->setEnType($EnType->App);
		$map->AddTBStringPK(EmpAttr::$No, NULL, "登陆账号",  TRUE ,  FALSE , 1, 50, 90);
		$map->AddTBString(EmpAttr::$Name, NULL, "名称",  TRUE ,  FALSE , 0, 200, 130);
		$map->AddTBString(EmpAttr::$Pass, "123", "密码",  FALSE ,  FALSE , 0, 100, 10);
		$map->AddDDLEntities(EmpAttr::$FK_Dept, NULL, "主要部门", Depts::constructor__(),  TRUE );
		$map->AddTBString(EmpAttr::$SID, NULL, "安全校验�?",  FALSE ,  FALSE , 0, 36, 36);
		$map->AddTBString(EmpAttr::$Tel, NULL, "电话",  TRUE ,  FALSE , 0, 20, 130);
		$map->AddTBString(EmpAttr::$Email, NULL, "邮箱",  TRUE ,  FALSE , 0, 100, 132,  TRUE );
		$map->AddTBString(EmpAttr::$PinYin, NULL, "拼音",  TRUE ,  FALSE , 0, 500, 132,  TRUE );
		$map->AddTBString(EmpAttr::$Manager, NULL, "Manager",  TRUE ,  FALSE , 0, 500, 132,  TRUE );
		$map->AddTBString("mobile", NULL, "mobile",  TRUE ,  FALSE , 0, 500, 132,  TRUE );
		$map->AddTBInt(EmpAttr::$Idx, 0, "序号",  TRUE ,  FALSE );
		$this->set_enMap($map);
		return $this->get_enMap();
	}
}
?>
